import axios from 'axios'
axios.defaults.timeout = 50000
axios.interceptors.response.use((config) => {
 console.log(config);
 return config
})
const baseURL = 'https://music.icci.top'
const requestGET = (url, paydata, reqParams) => {
    return new Promise((resolve, reject) => {
        axios({
            url,
            baseURL,
            method: 'get',
            data: paydata,
            headers: {
                'Content-type': reqParams ? reqParams : 'application/x-www-form-urlencoded'
            }
        }).then((res) => {
            resolve(res.data)
        }).catch((err) => {
            reject(err)
        })
    })

}
const requestPOST = (url, paydata, reqParams) => {
    return new Promise((resolve, reject) => {
        axios({
            url,
            baseURL,
            method: 'post',
            data: paydata,
            headers: {
                'Content-type': reqParams ? reqParams : 'application/x-www-form-urlencoded'
            }
        }).then((res) => {
            resolve(res.data)
        }).catch((err) => {
            reject(err)
        })
    })
}
export { requestGET,requestPOST }